<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>邀请</title>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/Invitation/css/base.min.css" />
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/Invitation/css/style.css" />
		<link rel="stylesheet" href="__PUBLIC__/js/tipbox/tipbox.css">
		<style>
			body,
			html {
				background: url(__PUBLIC__/Invitation/image/Invitation_bg_02.png) !important;
				-webkit-background-size: cover !important;
				background-size: cover !important;
				background-attachment: fixed !important;
			}
			
			.bn_footer_input {
				position: absolute;
			}
			
			.p_input {
				border-radius: 30px;
				-moz-border-radius: 30px;
				-webkit-border-radius: 30px;
				padding: 10px 20px;
			}
			
			.p_submit {
				border-radius: 50px;
				-moz-border-radius: 50px;
				-webkit-border-radius: 50px;
			}
			.bn_get_code {
				background: url(__PUBLIC__/Invitation/image/get_code_bg.png);
				background-size: 100%;
			}
			
			.bn_footer_download{
				height:50px;
				background:#fff;
				position:fixed;
				bottom:0px;
				width:100%;
				background:#ff2e4d
			}
		</style>
	</head>

	<body>
		<div class="bn_body">
			<div class="bn_header H-float-left H-width-100-percent">
				<img src="__PUBLIC__/Invitation/image/Invitation_pk_header_bg.png" class="H-width-100-percent H-float-left" />
			</div>
			<div class="bn_footer H-float-left H-width-100-percent">
				<img src="__PUBLIC__/Invitation/image/Invitation_pk_footer_bg.png" class="H-width-100-percent H-float-left" />
				<!--推荐用户类型-->
				 <php>$type_s = array("1"=>"用户","2"=>"跑客");</php>
				<div class="H-theme-font-color-white bn_footer_input H-width-100-percent H-text-align-center H-font-size-14">
					<!--<div class="H-font-size-14">您的好友推荐您成为帮你跑腿{$type_s[$type]}</div>-->
					<!--手机号-->
					<div class="" style="padding:6px 50px;">
						<input type="tel" name="tel" id="tel" placeholder="手机号" class="H-theme-background-color-white p_input H-border-both  H-width-100-percent H-textbox H-vertical-align-middle H-vertical-middle H-font-size-14 H-flex-item H-box-sizing-border-box H-border-none H-outline-none H-padding-8">
					</div>
					<!--手机号-->
					<!--验证码-->
					<div class="" style="padding:0px 50px 6px;">
						<div class="H-flexbox-horizontal">
							<div class="H-flex-item H-theme-background-color-white" style="border-top-left-radius: 30px;border-bottom-left-radius: 30px;">
								<input type="tel" name="code" id="code" placeholder="验证码" style="border-top-left-radius: 30px;border-bottom-left-radius: 30px;padding: 10px 20px;width: 100px;" class="H-border-both H-textbox H-vertical-align-middle H-vertical-middle H-font-size-14 H-theme-background-color-white H-flex-item H-box-sizing-border-box H-border-none H-outline-none H-padding-8 ">
							</div>
							<span id="getcode" style="border-bottom-right-radius: 30px;border-top-right-radius: 30px;width: 80px;" class="H-vertical-middle H-padding-horizontal-right-5 H-padding-horizontal-left-5 H-theme-background-color-white H-theme-font-color7 H-font-size-12 H-text-align-center">获取验证码</span>
						</div>
					</div>
					<!--验证码-->
					<!--兑换代金券-->
					<div class="" style="padding:0px 50px 0px;">
						<img id="p_submit" status="1" disabled src="__PUBLIC__/Invitation/image/Invitation_pk_submit.png" class="H-width-100-percent" />
					</div>
					<!--兑换代金券-->
					<div class="H-theme-font-color-white H-font-size-12" id="register">>>注册成为用户<<</div>
					<!--<div class="H-theme-font-color-white H-font-size-12" id="download_pks">>>下载跑客端APP<<</div> -->
				</div>
				<!--推荐用户类型-->
			
			</div>
		</div>
		<div style="height:50px;">&nbsp;</div>
		<div class="bn_footer_download">
			<div class="H-flexbox-horizontal" style="padding-top:5px">
				<div style="width:50px;margin-left:10px">
					<img src="__PUBLIC__/Invitation/image/run_logo.png" width="40" />
				</div>
				<div class="H-flex-item">
					<div class="H-font-size-14 H-theme-font-color-white H-font-weight-bold">帮你跑客</div>
					<div class="H-font-size-12 H-theme-font-color-white H-text-show-row-1">全民跑腿时代到来，还不快来!</div>
				</div>
				<div class="H-flex-item">
					<div class=""><a href="{:U('jump_pk')}">
						                <button class="H-font-size-12 H-theme-background-color-transparent H-padding-vertical-both-5 H-padding-horizontal-both-1 H-theme-font-color7 H-theme-border-color-white H-theme-border-color3-click H-theme-background-color-white-click H-theme-font-color-white-click H-border-radius-3 H-theme-background-color-white H-float-right" style="margin-right:10px;margin-top:5px">
                立即下载
                </button></a>
					</div>
					
				</div>
			</div>
		</div>
		
	<!--推荐背景-->
        <script src="__PUBLIC__/Invitation/js/zepto.min.js"></script>
    <script src="__PUBLIC__/js/tipbox/tipbox.js"></script>
	<script src="https://s11.cnzz.com/z_stat.php?id=1260881733&web_id=1260881733" language="JavaScript"></script>
    <script>
        var wait = 60;
        Zepto(function () {
            //处理获取短信验证码
            $("#getcode").click(function () {
                var tel = $("#tel").val();
                var code = $("#code").val();
                var myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(17[0-9]{1})|(15[0-3]{1})|(15[5-9]{1})|(18[0-9]{1}))+\d{8})$/;
                if (tel == '') {
                    new TipBox({type: 'error', str: '手机号码不能为空!', setTime: 1500});
                } else if (tel.length != 11) {
                    new TipBox({type: 'error', str: '请输入有效的手机号码!', setTime: 1500});
                } else if (!myreg.test(tel)) {
                    new TipBox({type: 'error', str: '请输入有效的手机号码!', setTime: 1500});
                } else {
                    $.ajax({
                        url: "{:U('Api/V1/getSMS')}?phone=" + tel,
                        data: "",
                        dataType: "JSON",
                        beforeSend: function () {
                            new TipBox({type: 'load', str: "短信发送中..", setTime: 1000});
                        },
                        success: function (ret) {
                            var rets = eval('(' + ret + ')');
                            if (rets.retCode == 0) {
                                new TipBox({type: 'success', str: '短信发送成功！', setTime: 1500});
                                $("#p_submit").attr("status", 2);
                                time();
                            } else {
                                layer.msg(rets.retDesc);
                            }

                        }
                    })
                }
            });
			$("#register").click(function(){
				window.location.href="{:U('invitation')}?type=1&uid={$uid}&user_type={$user_type}";
			});
			$("#download_pks").click(function(){
				window.location.href = "{:U('jump_pk')}";
			});
			
            //注册
            $("#p_submit").click(function () {
		
                var status = $("#p_submit").attr("status");
                if (status == "2") {
                    var code = $("#code").val();
                    var tel = $("#tel").val();
                    if (code == "") {
                        new TipBox({type: 'error', str: '验证码为空!', setTime: 1500});
                    } else {
                        $.ajax({
                            url: "{:U('Api/Invitation/invitationcheck')}/tel/" + tel + '/type/{$type}/code/' + code + '/user_type/{$user_type}/uid/{$uid}/',
                            dataType: "JSON",
                            success: function (ret) {
                                var rets = eval('(' + ret + ')');
                                if (rets.retCode == 1) {
                                    new TipBox({type: 'success', str: rets.retDesc, setTime: 1500});
                                    setTimeout(function(){
                                       if({$type} == 1){
											window.location.href="{:U('download_pt')}";
									   }else{
											window.location.href="{:U('download_pk')}";
									   }
                                    },500);
                                } else {
                                    new TipBox({type: 'error', str: rets.retDesc, setTime: 1500});
                                }

                            }
                        });
                    }

                }else if(status=="1"){
				    new TipBox({type: 'error', str: '抱歉，输入有误!', setTime: 1500});
				}
            });
        });

        //倒计时含糊
        function time() {
            var getcode = $("#getcode");
            if (wait == 0) {
                getcode.bind('click',function(){
					 var tel = $("#tel").val();
                var code = $("#code").val();
                var myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(17[0-9]{1})|(15[0-3]{1})|(15[5-9]{1})|(18[0-9]{1}))+\d{8})$/;
                if (tel == '') {
                    new TipBox({type: 'error', str: '手机号码不能为空!', setTime: 1500});
                } else if (tel.length != 11) {
                    new TipBox({type: 'error', str: '请输入有效的手机号码!', setTime: 1500});
                } else if (!myreg.test(tel)) {
                    new TipBox({type: 'error', str: '请输入有效的手机号码!', setTime: 1500});
                } else {
                    $.ajax({
                        url: "{:U('Api/V1/getSMS')}?phone=" + tel,
                        data: "",
                        dataType: "JSON",
                        beforeSend: function () {
                            new TipBox({type: 'load', str: "短信发送中..", setTime: 1000});
                        },
                        success: function (ret) {
                            var rets = eval('(' + ret + ')');
                            if (rets.retCode == 0) {
                                new TipBox({type: 'success', str: '短信发送成功！', setTime: 1500});
                                $("#p_submit").attr("status", 2);
                                time();
                            
                            } else {
                                layer.msg(rets.retDesc);
                            }

                        }
                    })
                }
				});
                getcode.text("获取验证码");
                wait = 60;
               
            } else {
               
                getcode.unbind('click');
                getcode.text("重新发送(" + wait + ")");
                wait--;
                setTimeout(function () {
                    time()
                }, 1000);
            }
        }


    </script>
	</body>

</html>